package krow.dev.addetector.view.dialog;

import krow.dev.addetector.R;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

public class ModuleInfoDialog extends Dialog implements OnClickListener{

	private TextView mTitleView;
	private TextView mContentView;
	
	public ModuleInfoDialog(Context context) {
		super(context);

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
		WindowManager.LayoutParams windowParams = getWindow().getAttributes();
		windowParams.dimAmount = 0.7f;
		getWindow().setAttributes(windowParams);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND);
		setContentView(R.layout.dialog_info);

		mTitleView = (TextView) findViewById(R.id.text_title);
		mContentView = (TextView) findViewById(R.id.text_content);
	
		findViewById(R.id.button_confirm).setOnClickListener(this);
	}

	@Override
	public void dismiss() {
		super.dismiss();
	}
	
	@Override
	public void onClick(View view) {
		switch (view.getId()) {
		case R.id.button_confirm:
			dismiss();
			break;
		}
	}

	public void setTitle(String title) {
		mTitleView.setText(title);
	}

	public void setContent(String content) {
		mContentView.setText(content);
	}
}
